//go:generate protoc -I ../../../protobuf/gateway:../../../protobuf/common --go_out=plugins=grpc,Mcommon.proto=aquaman/app/biz/m:../.. lottery.proto
package lottery

import (
	"context"
)

type GrpcBinding struct {
	Service
}

func NewGRPC(svc *Service) *GrpcBinding {
	return &GrpcBinding{Service: *svc}
}


func (s *GrpcBinding) GetLastestLottery(ctx context.Context, in *GetLastestLotteryRequest) (*GetLastestLotteryResponse, error) {
	out := new(GetLastestLotteryResponse)
	list := s.Service.GetLastestLottery(ctx)
	out.Lottery = list
	return out, nil
}

func (s *GrpcBinding) GetLotteries(ctx context.Context, in *GetLotteriesRequest) (*GetLotteriesResponse, error) {
	out := new(GetLotteriesResponse)
	lotteryType := in.GetType()
	page := in.GetPage()
	perPage := in.GetPerPage()
	list,isEnd := s.Service.GetLotteryByType(ctx,lotteryType,page,perPage)
	out.Lottery = list
	out.IsEnd = isEnd
	return out, nil
}

